package su.camunda.operate.delegate;

import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.springframework.stereotype.Component;

import lombok.extern.slf4j.Slf4j;

@Component
@Slf4j
public class SpelLeafEval {


    public boolean eval(String testFlag, DelegateExecution execution) {
        String processInstanceId = execution.getProcessInstanceId();
        Object dataJson = execution.getVariable("dataJson");
        log.info("processInstanceId: {}, dataJson: {}", processInstanceId, dataJson);

        log.info("================spel=======================");
        execution.getVariables().forEach((k, v) -> {
            log.info("k:{},v:{}", k, v);
        });
        log.info("================spel=======================");

        try {
            return Boolean.valueOf(testFlag).equals(Boolean.TRUE);
        }catch (Exception e) {
            return false;
        }
    }

}
